package cn.itcast.tools.java发送文件.客户端服务器;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class client {
    public static void main(String[] args) throws Exception
    {
        Socket s = new Socket("30.210.208.127",8080);//建立服务
//        BufferedReader bufr = new BufferedReader(new FileReader("/Users/feiyi-lgh/Documents/projectSrc/javaSrc/语音交互/demo/target/classes/static/file_syn_test/2021_9_28_1845_55049.wav"));//读取IO.JAVA文件
        BufferedReader bufr = new BufferedReader(new FileReader("./aaa.png"));//读取IO.JAVA文件

        PrintWriter pw = new PrintWriter(s.getOutputStream(),true);//将读到的写入服务端
        String line = null;
        while((line = bufr.readLine())!=null)
        {
            pw.println(line);
        }
//   pw.println("over");//标记结束位置
        s.shutdownOutput();
        BufferedReader bufin = new BufferedReader(new InputStreamReader(s.getInputStream()));//读取服务端返回的数据
        String str = bufin.readLine();
        System.out.println(str);
        bufr.close();
        s.close();
    }
}
